<%@ page import="org.jeecgframework.web.util.StaticValue" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="t" uri="/easyui-tags" %>
<%@include file="/context/mytags.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>查看服务单</title>
    <t:base type="jquery,easyui,tools,DatePicker"></t:base>
    <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css"/>
    <script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
    <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.min.js"></script>
    <script type="text/javascript" src="plug-in/jquery/ajaxfileupload.js"></script>
    <script type="text/javascript" src="plug-in/jquery/jquerysession.js"></script>
    <script type="text/javascript" src="webpage/com/zybk/cbsservice/cbsServiceDispatchOrder.js"></script>
    <style type="text/css">
        .noSelect {
            border: 0;
            min-height: 1.146667rem;
            line-height: 1.146667rem;
            color: #000000;
            white-space: nowrap;
            overflow: hidden;
            padding-right: .6rem;
            background-color: #eee;
            background: transparent;
            appearance: none;
            -moz-appearance: none; /* Firefox */
            -webkit-appearance: none; /* Safari 和 Chrome */
        }

        .titles {
            text-indent: 25px;

        }
    </style>
    <script>
        $(function () {
            var cbsId = '${mapList.cid}';
            //服务单已完成，改类型没有完工报告，则初始化编辑页面时，隐藏 查看完工报告 按钮
            $.ajax({
                url: "cbsServiceReportController.do?lookReportByHD",
                type: "post",
                data: {"id": cbsId},
                dataType: "json",
                async: false,
                cache: false,
                success: function (data) {
                    var raData = data.attributes;
                    if (raData.ty == 0) { //0为没有完工单或者没有完工
                        $("#lookreport").css("display", "none");
                    }
                }
            });
        });

        function lookReport(id) {
            $.ajax({
                url: "cbsServiceReportController.do?lookReportByHD",
                type: "post",
                data: {"id": id},
                dataType: "json",
                async: false,
                cache: false,
                success: function (data) {

                    var raData = data.attributes;
                    // alert(raData.status+"-----"+raData.ty);
                    if (raData.status != 4) {
                        tip("该服务单没有完工单");
                        return false;
                    }
                    //现场、远程服务完工报告
                    if (raData.reportType == 1) {

                        addOneTab('完工报告', 'cbsServiceReportController.do?lookFinishReport&id=' + raData.reportId);
                    }
                    if (raData.reportType == 3) {
                        addOneTab('引擎翻新现场检测完工单详情', 'cbsServiceReportController.do?goEngineRefurbishedDetail&id=' + raData.reportId);
                    }
                    if (raData.reportType == 4) {
                        addOneTab('现场检测完工单详情', 'cbsServiceReportController.do?goReferDetectionDetail&id=' + raData.reportId);
                    }
                    if (raData.reportType == 5) {
                        //alert(raData.reportId);
                        addOneTab('光管翻新验收单', 'cbsServiceReportController.do?goLighttubeAcceptanceDetail&id=' + raData.reportId);
                    }
                    if (raData.reportType == 6) {
                        addOneTab('技术支持完工单', 'cbsServiceReportController.do?goTechnologyAgreeDetail&id=' + raData.reportId);
                    }
                    if (raData.reportType == 7) {
                        addOneTab('引擎翻新验收单详情', 'cbsServiceReportController.do?goEngineRefurbishedSignDetail&id=' + raData.reportId);
                    }
                }

            })
            // addOneTab("查看完工报告", "cbsServiceReportController.do?lookReport&id=" + id, "");
        }
    </script>
</head>

<body>
<div style="margin-bottom:20px;margin-top: 20px;">
    <img style="margin-bottom:-7px" src="plug-in/login/images/dispatch bill.png">
    <span class="list-title" id="code">${cbsCode}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span style="font-size:13px;">状态：
        <span class="color-red">
            ${mapList.speed}
        </span>
    </span>
    <div style="position: absolute; text-align: center; width: 100%; margin-top:-20px;">
        <a href="#" class="easyui-linkbutton l-btn" id="lookreport" onclick="lookReport('${mapList.cid}')">查看完工报告</a>
    </div>
</div>

<div class="subtitle">
    <p>客户信息</p>
    <table class="nobordertable noborder">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>联系人电话:</label>
            </td>
            <td width="30%">
                ${mapList.contactsphone}
            </td>
            <td class="al_r" width="20%">
                <label>联系人邮箱:</label>
            </td>
            <td width="30%">
                ${mapList.email}
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>联系人姓名:</label>
            </td>
            <td width="30%">
                ${mapList.name}&nbsp;&nbsp;<span class="color-red">${mapList.authenticationlevel}</span>
            </td>
            <td class="al_r" width="20%">
                <label>QQ号码:</label>
            </td>
            <td width="30%">
                ${mapList.qq}
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label class="color-org">提示:</label>
            </td>
            <td colspan="3" class="color-hui">
                该用户所属影院：${mapList.ciname}。影城地址：${mapList.ciaddress}
            </td>

        </tr>

        </tbody>
    </table>
</div>
<div class="subtitle">
    <p>设备信息</p>
    <div class="wrap">
        <div class="tit" id="ct">
            <span class="select">放映机信息</span>
            <span>服务器信息</span>
        </div>
        <ul class="con" id="cl">
            <li class="show">
                <table class="nobordertable noborder">
                    <tbody>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>设备序列号:</label>
                        </td>
                        <td width="30%">
                            <input readonly="readonly" class="noSelect" name="sn" value="${mapList.sn}" id="sn">
                            <span class="color-blue"><a href="#"
                                                        onclick="viewDetail('${mapList.sid}')">[设备详情]</a></span>
                        </td>
                        <td class="al_r" width="20%">
                            <label>BP:</label>
                        </td>
                        <td width="30%">
                            <span id="bp">${mapList.bpno}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>产品分类:</label>
                        </td>
                        <td width="30%">
                            <span id="typeDesc">${mapList.typedesc}</span>
                        </td>
                        <td class="al_r" width="20%">
                            <label>BP描述:</label>
                        </td>
                        <td width="30%">
                            <span id="shortname" name="shortname">${mapList.shortname}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>设备型号:</label>
                        </td>
                        <td width="30%">
                            <span id="topItemSn">${mapList.typedesc1}</span>&nbsp;:&nbsp;<span 
                                    id="esitemDesc">${mapList.esitemDesc}</span>
                        </td>
                        <td class="al_r" width="20%">
                            <label>使用状态:</label>
                        </td>
                        <td width="30%">
                            <span id="serverState">
                                ${mapList.servicestate}
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>激光改造类型:</label>
                        </td>
                        <td width="30%">
                            <span id="laserreconstructiontype">${mapList.laserreconstructiontype}</span>
                        </td>
                        <td class="al_r" width="20%">
                            <label>安装日期:</label>
                        </td>
                        <td width="30%">
                            <span id="installDate">
                                ${mapList.install_date}
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>是否异常:</label>
                        </td>
                        <td width="30%">
                            <span id="isNormal"> ${mapList.is_normal}</span>
                            <span id="exceptionReason" style="color: red">
                                ${mapList.exceptionreason}
                            </span> <%--异常原因--%>
                        </td>
                        <td class="al_r" width="20%">
                            <label>保修期状态:</label>
                        </td>
                        <td width="30%">
                            <span id="baoxiuqi">${mapList.inReparirDateVal}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>设备备注:</label>
                        </td>
                        <td width="30%">
                            <span id="remarks">${mapList.remarks}</span>
                        </td>
                        <td class="al_r" width="20%">
                            <label>保修期起止时间:</label>
                        </td>
                        <td width="30%">
                            <span id="warranty_begin_date">
                                ${mapList.warrantyBeginDate}
                            </span>
                            ~
                            <span id="repair_end_date">
                                ${mapList.repairEndDate}
                            </span>
                        </td>
                    </tr>

                    <tr>
                        <td class="al_r" width="20%">
                            <label>版本信息:</label>
                        </td>
                        <td colspan="3">
                            ${mapList.vcreate_date}&nbsp;&nbsp;&nbsp;放映机软件版本：${mapList.v1}&nbsp;&nbsp;&nbsp;ICP/TI/ICMP软件版本:${mapList.v2}
                        </td>

                    </tr>
                    </tbody>
                </table>
            </li>
            <li>
                <table class="nobordertable noborder">
                    <tbody>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>设备序列号:</label>
                        </td>
                        <td width="30%">
                            <input name="snService" id="snService" readonly="readonly" class="noSelect"
                                   value="${mapList.snService}">
                            <span class="color-blue"><a href="#" onclick="view('${mapList.sp1id}')">[设备详情]</a></span>
                        </td>
                        <td class="al_r" width="20%">
                            <label>BP:</label>
                        </td>
                        <td width="30%">
                            <span id="bpServer">${mapList.bpNoService}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>产品分类:</label>
                        </td>
                        <td width="30%">
                            <span id="typeDescServer">${mapList.typedescService}</span>
                        </td>
                        <td class="al_r" width="20%">
                            <label>BP描述:</label>
                        </td>
                        <td width="30%">
                            <span id="shortnameService" name="shortnameService">${mapList.shortnameService}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>设备型号:</label>
                        </td>
                        <td width="30%">
                            <span id="topItemSnService">${mapList.typedesc1Service}</span>&nbsp;:&nbsp;<span 
                                    id="esitemDesc">${mapList.esitemDesc}</span>
                        </td>
                        <td class="al_r" width="20%">
                            <label>使用状态:</label>
                        </td>
                        <td width="30%">
                            <span id="serverStateService">
                                ${mapList.servicestateService}
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>是否异常:</label>
                        </td>
                        <td width="30%">
                            <span id="isNormalService">
                                ${mapList.is_normalSerrvice}
                            </span>
                            <span id="exceptionReasonService" style="color: red">
                                ${mapList.exceptionreasonService}
                            </span> <%--异常原因--%>
                        </td>
                        <td class="al_r" width="20%">
                            <label>安装日期:</label>
                        </td>
                        <td width="30%">
                            <span id="installDateServer">
                                ${mapList.install_dateService}
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>设备备注:</label>
                        </td>
                        <td width="30%">
                            <span id="remarksServer">${mapList.remarksService}</span>
                        </td>
                        <td class="al_r" width="20%">
                            <label>保修期状态:</label>
                        </td>
                        <td width="30%">
                            <span id="baoxiuqiService">${mapList.inReparirDateValService}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>保修期起止时间:</label>
                        </td>
                        <td width="30%">
                            <span id="warranty_begin_dateServer">
                                ${mapList.warrantyBeginDateService}~
                            <span id="repair_end_dateServer">
                                ${mapList.repairEndDateService}
                            </span>
                        </td>
                        <td class="al_r" width="20%">

                        </td>
                        <td width="30%">

                        </td>
                    </tr>
                    <tr>
                        <td class="al_r" width="20%">
                            <label>版本信息:</label>
                        </td>
                        <td colspan="3">
                            ${mapList.vcreate_dateService}&nbsp;&nbsp;&nbsp;放映机软件版本：${mapList.v1Service}&nbsp;&nbsp;&nbsp;ICP/TI/ICMP软件版本:${mapList.v2Service}
                        </td>
                    </tr>
                    </tbody>
                </table>
            </li>
        </ul>
    </div>
    <table class="nobordertable noborder">
        <tbody>
        <tr>

            <td class="al_r" width="20%">
                <label>影院名称:</label>
            </td>
            <td width="40%">
                ${mapList.ciname}
                <input type="hidden" name="zyCinemaIds" id="zyCinemaIds" value="${mapList.cinameid}">
                <span class="color-blue">&nbsp;&nbsp;
                    <a href="#" onclick="cinemaView()">[影院详情]</a>
                </span>
            </td>
            <td class="al_r" width="10%">
                <label>院线:</label>
            </td>
            <td width="30%">
                ${mapList.typename}
            </td>

        </tr>
        <tr>

            <td class="al_r" width="20%">
                <label>影院地址:</label>
            </td>
            <td colspan="3">
                <select class="noSelect" disabled="true" class="sele" style="width: 20%;float:left;margin-right: 3px;margin-bottom: 4px" name="province"
                        id="province" onchange="loadCity()">
                    <option value="">-- 请选择 --</option>
                    <c:forEach items="${territoryList }" var="terr">
                        <option value="${terr.id}" <c:if
                                test="${mapList.province==terr.id}"> selected="selected" </c:if> >${terr.territoryName }</option>
                    </c:forEach>
                </select>
                <select class="noSelect" disabled="true" class="sele" style="width: 25%;float:left;margin-right: 3px;margin-bottom: 4px" name="city"
                        id="city">
                </select><br><br>
                <div>
                    <input class="noSelect" style="width: 600px;" readonly="readonly" id="zyCinemaAddress"
                           name="zyCinemaAddress" value="${mapList.address}"/>
                </div>
            </td>
        </tr>
        </tbody>
    </table>
    <div class="line"></div>
    <div class="titles"><span style="font-weight: bold; font-size: 14px !important;">SLA</span></div>
    <table class="nobordertable noborder">
        <tbody>
        <tr>

            <td class="al_r" width="20%">
                <label>服务起止时间:</label>
            </td>
            <td width="30%">
                ${slaList1.warranty_begin_date}~${slaList1.REPAIR_END_DATE}
            </td>
            <td class="al_r" width="20%">
                <label>服务商:</label>
            </td>
            <td width="30%">
                <span id="slashortname">${slaList1.shortname}</span>&nbsp;&nbsp;${slaList1.repairType}
            </td>

        </tr>
        <tr>

            <td class="al_r" width="20%">
                <label>年度巡检次数:</label>
            </td>
            <td width="30%">
                ${slaList1.s1}
            </td>
            <td class="al_r" width="20%">
                <label>工程师级别要求:</label>
            </td>
            <td width="30%">
                ${slaList1.s2}
            </td>
        </tr>
        <tr>

            <td class="al_r" width="20%">
                <label>特别服务承诺:</label>
            </td>
            <td width="30%">
                ${slaList1.SERVICECOMMITMENT}
            </td>
            <td class="al_r" width="20%">
                <label>巡检光路:</label>
            </td>
            <td width="30%">
                ${slaList1.s3}
            </td>
        </tr>
        <tr>

            <td class="al_r" width="20%">
                <label>SLA增减项:</label>
            </td>
            <td width="30%">
                ${slaList1.supplement}
            </td>
            <td class="al_r" width="20%">
                <label>是否含硬盘维修:</label>
            </td>
            <td width="30%">
                ${slaList1.s4}
            </td>
        </tr>
        </tbody>
    </table>
    <div class="line"></div>
    <div class="wrap">
        <div class="tit" id="ct1">
            <span id="span1" class="select">设备相关历史(${fn:length(serviceBySn)})</span>
            <span id="span2">影院相关历史(${fn:length(cinemaMapList)})</span>
            <span id="span3">巡检相关历史(${fn:length(allPlanBySn)})</span>
            <a style="float: right; margin-top:8px;" class="color-blue" onclick="spread()">展开》</a>
        </div>
        <ul class="con" id="cl1">
            <li class="show">
                <table class="ftable">
                    <thead>
                    <tr>
                        <th>服务单号</th>
                        <th>服务类型</th>
                        <th>故障分类</th>
                        <th>服务状态</th>
                        <th>服务商</th>
                        <th>服务商处理进度</th>
                        <th>创建时间</th>
                        <th>关单时间</th>
                    </tr>
                    </thead>
                    <tbody id="cbsservicelist">
                    <c:forEach items="${serviceBySn}" var="cbs" varStatus="a">
                        <c:if test="${a.index<5}">
                            <tr>
                                <td><a href="#" style="color:blue;text-decoration:underline;"
                                       onclick="cbsServiceDetials('${cbs.id}','${cbs.code}')">${cbs.code}</a></td>
                                <td>
                                    <c:if test="${not empty cbs.t1name}">${cbs.t1name}>>${cbs.t2name}</c:if>
                                </td>
                                <td>
                                    <c:if test="${not empty cbs.e1name}">${cbs.e1name}>>${cbs.e2name}</c:if>
                                </td>
                                <td>${cbs.sta}</td>
                                <td>${cbs.shortname}</td>
                                <td>${cbs.speed}</td>
                                <td>${cbs.create_date}</td>
                                <td>${cbs.close_time}</td>
                            </tr>
                        </c:if>
                    </c:forEach>
                    </tbody>
                </table>
            </li>
            <li>
                <table class="ftable">
                    <thead>
                    <tr>
                        <th>服务单号</th>
                        <th>设备SN</th>
                        <th>服务类型</th>
                        <th>服务状态</th>
                        <th>服务商</th>
                        <th>服务商处理进度</th>
                        <th>创建时间</th>
                        <th>关单时间</th>
                    </tr>
                    </thead>
                    <tbody id="cbsservicelist1">
                    <c:forEach items="${cinemaMapList}" var="cb" varStatus="a">
                        <c:if test="${a.index<5}">
                            <tr>
                                <td><a href="#" style="color:blue;text-decoration:underline;"
                                       onclick="cbsServiceDetials('${cb.id}','${cb.code}')">${cb.code}</a></td>
                                <td>${cb.sn}</td>
                                <td>
                                    <c:if test="${not empty cb.t1name}">${cb.t1name}>>${cb.t2name}</c:if>
                                </td>
                                <td>${cb.sta}</td>
                                <td>${cb.shortname}</td>
                                <td>${cb.speed}</td>
                                <td>${cb.create_date}</td>
                                <td>${cb.close_time}</td>
                            </tr>
                        </c:if>
                    </c:forEach>
                    </tbody>
                </table>
            </li>
            <li>
                <table class="ftable">
                    <thead>
                    <tr>
                        <th>服务单号</th>
                        <th>状态</th>
                        <th>计划巡检月份</th>
                        <th>预约上门时间</th>
                        <th>服务商</th>
                        <th>工程师</th>
                        <th>实际巡检时间</th>
                    </tr>
                    </thead>
                    <tbody id="cbsservicelist2">
                    <c:forEach items="${allPlanBySn}" var="plan" varStatus="a">
                        <c:if test="${a.index<5}">
                            <tr>
                                <td><a href="#" style="color:blue;text-decoration:underline;"
                                       onclick="planDetials('${plan.id}','${plan.planIds}')">${plan.planIds}</a></td>
                                <td>${plan.state}</td>
                                <td>${plan.dates}</td>
                                <td>${plan.time}</td>
                                <td>${plan.shortname}</td>
                                <td>${plan.eName}</td>
                                <td>${plan.beginTime}</td>
                            </tr>
                        </c:if>
                    </c:forEach>
                    </tbody>
                </table>
            </li>
        </ul>
    </div>
</div>
<div class="subtitle">
    <p>服务描述</p>
    <div class="titles"><span style="font-weight: bold; font-size: 14px !important;">客户相关描述</span></div>
    <table class="nobordertable noborder">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>委托方:</label>
            </td>
            <td width="40%">
                ${mapList.client}
                <span style="color: red">仅限巴可内部服务需求</span>
            </td>
            <td class="al_r" width="10%">

            </td>
            <td width="30%">

            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>服务来源:</label>
            </td>
            <td width="40%">
                <t:dictSelect readonly="readonly" field="sourceType" id="sourceType" type="select" clazz="noSelect"
                              typeGroupCode="<%=StaticValue.Source_Type %>" defaultVal="${mapList.sourceType}"/>
            </td>
            <td class="al_r" width="10%">
                <label>故障照片:</label>
            </td>
            <td width="30%">
                <c:if test="${not empty zyFileLogEntityA}">
                    <c:forEach items="${zyFileLogEntityA}" var="a">
                        <div class="fileIda" id="fileIda" style="width:90%">
                            <input type="hidden" id="fileIdas" value='${a.id}'>
                            <span class="color-blue" id='${a.id}'><a style="color:blue;"
                                                                     href="fileUploadController.do?downLoadFile&fileLogId=${a.id}">${a.oldFileName }</a></span>
                        </div>
                    </c:forEach>
                </c:if>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>故障代码:</label>
            </td>
            <td width="40%">
                <span name="errorCodeSpan" id="errorCodeSpan"></span>
            </td>
            <td class="al_r" width="10%">

            </td>
            <td width="30%">

            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%" valign="top">
                <label>服务描述:</label>
            </td>
            <td colspan="3" class="color-hui">
                ${mapList.description}
            </td>

        </tr>

        </tbody>
    </table>
    <div class="line"></div>
    <div class="titles"><span style="font-weight: bold;font-size: 14px !important;">HD预判断</span></div>
    <table class="nobordertable noborder">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>服务类型:</label>
            </td>
            <td width="40%">
                <select class="noSelect" disabled="disabled" style="width: 164px;float:left;margin-right: 2px"
                        name="serviceType1" id="serviceType1">
                    <c:forEach items="${serviceTypeList }" var="terr">
                        <option value="${terr.id}" <c:if
                                test="${mapList.service_type_1==terr.id}"> selected="selected" </c:if> >${terr.name }</option>
                    </c:forEach>
                </select>
                <select class="noSelect" disabled="disabled" style="width: 164px;float:left" name="serviceType2"
                        id="serviceType2">
                </select>
            </td>
            <td class="al_r" width="10%">
                <label>是否特批:</label>
            </td>
            <td width="30%">
                <input type="checkbox" name="specially" disabled="disabled" id="specially" <c:if
                        test="${mapList.special eq 1}"> checked="checked" </c:if> />
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>故障分类:</label>
            </td>
            <td width="40%">
                <c:if test="${mapList.error_type_1 !='' && mapList.error_type_1!=null}">
                    <select class="noSelect" disabled="disabled" style="width: 164px;float:left;margin-right: 2px"
                            name="errorType1" id="errorType1">
                        <c:forEach items="${errorTypeList }" var="terr">
                            <option value="${terr.id}" <c:if
                                    test="${mapList.error_type_1==terr.id}"> selected="selected" </c:if> >${terr.name }</option>
                        </c:forEach>
                    </select>
                    <select class="noSelect" disabled="disabled" style="width: 164px;float:left" name="errorType2"
                            id="errorType2">
                    </select>
                </c:if>
            </td>
            <td class="al_r" width="10%">
                <label>是否HD关单:</label>
            </td>
            <td width="30%">
                <input type="checkbox" name="speciallyHD" disabled="disabled" id="speciallyHD" <c:if
                        test="${mapList.hdClose eq 1}"> checked="checked" </c:if>/>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>关键备件故障:</label>
            </td>
            <td width="40%">
                <c:if test="${mapList.equipment_error_type_1!='' && mapList.equipment_error_type_1!=null}">
                    <select class="noSelect" disabled="disabled" style="width: 164px;float:left;margin-right: 2px"
                            name="equipmentErrorType1" id="equipmentErrorType1">
                        <c:forEach items="${equipmentErrorTypeList }" var="terr">
                            <option value="${terr.id}" <c:if test="${mapList.equipment_error_type_1==terr.id}"> selected="selected" </c:if> >${terr.name }</option>
                        </c:forEach>
                    </select>
                    <select class="noSelect" disabled="disabled" style="width: 164px;float:left" name="equipmentErrorType2"
                            id="equipmentErrorType2">
                    </select>
                </c:if>
            </td>
            <td class="al_r" width="10%">
                <label>上传特批文件:</label>
            </td>
            <td width="30%">
                <c:if test="${not empty zyFileLogEntityB}">
                    <c:forEach items="${zyFileLogEntityB}" var="b">
                        <div class="fileIdb" id="fileIdb" style="width:90%">
                            <input type="hidden" id="fileIdbs" value='${b.id}'>
                            <span class="color-blue" id='${b.id}'><a style="color:blue;"
                                                                     href="fileUploadController.do?downLoadFile&fileLogId=${b.id}">${b.oldFileName }</a></span>
                        </div>
                    </c:forEach>
                </c:if>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>级别:</label>
            </td>
            <td width="40%">
                <t:dictSelect readonly="readonly" clazz="noSelect" field="level" id="level" type="select"
                              typeGroupCode="<%=StaticValue.serviceLevel %>"
                              defaultVal="${mapList.level}"/>
            </td>
            <td class="al_r" width="10%">
                <label>特殊案例标记:</label>
            </td>
            <td width="30%">
                <div style="width: 320px;">
                    <t:dictSelect field="specialCase" readonly="readonly" type="checkbox"
                                  typeGroupCode="<%=StaticValue.special_Case %>" defaultVal="${mapList.case_flag}"/>
                </div>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%" valign="top">
                <label>400预判断:</label>
            </td>
            <td colspan="3" class="color-hui">
                ${mapList.judge400}
            </td>

        </tr>

        </tbody>
    </table>
</div>
<input id="sessionId" type="hidden" value="${pageContext.session.id}"/>
<div class="subtitle">
    <p>巴可内部处理</p>
    <table class="nobordertable noborder">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>服务单状态:</label>
            </td>
            <td width="30%">
                <%--${cbsStatus}--%>
                <span class="color-red">
                    <t:dictSelect clazz="noSelect" readonly="readonly" field="status" id="status" type="select"
                                  defaultVal="${cbsStatus}" typeGroupCode="<%=StaticValue.Source_State %>"/>
                </span>
            </td>
            <td class="al_r" width="20%">
                <label>创单人:</label>
            </td>
            <td width="30%">
                ${createname}
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>当前责任人:</label>
            </td>
            <td width="30%">
                <input type="hidden" value="${personId}" id="personId">
                <span id="person_lain">${personLiable}</span>&nbsp;
            </td>

            <td class="al_r" width="20%">
                <label>关单人:</label>
            </td>
            <td width="30%">
                ${closeUser}
            </td>
        </tr>
        </tbody>
    </table>
    <div style="width: 98%; margin: 0 auto; padding:5px 0px;"><span
            style="font-size:16px; font-weight: bold;">处理描述</span>&nbsp;&nbsp;&nbsp;<span>共${fn:length(cbsHandleLogEntityList)}条</span>
        <a style="float: right; margin-top:4px;" class="color-blue" onclick="serviceCl('${mapList.cid}')">展开》</a>
    </div>
    <table class="ftable" id="zhuijia">
        <tr id="cbsLog">
            <th>业务责任人</th>
            <th>时间</th>
            <th>处理描述</th>
            <th>附件</th>
        </tr>
        <c:forEach items="${cbsHandleLogEntityList}" var="cbsHandleLog">
            <tr class="cbsHandleLog">
                <td>${cbsHandleLog.createName}</td>
                <td>${fn:substring(cbsHandleLog.createDate,0,19)}</td>
                <td>${cbsHandleLog.description}</td>
                <td>
                    <span class="color-blue"><a class="color-blue"
                                                href="fileUploadController.do?downLoadFile&fileLogId=${cbsHandleLog.zyFileLogId.id}">${cbsHandleLog.zyFileLogId.oldFileName}</a></span>
                </td>
            </tr>
        </c:forEach>
    </table>
    <table class="nobordertable noborder">
        <tbody>
        <tr>
            <td class="al_r" width="20%" valign="top">
                <label>添加描述:</label>
            </td>
            <td colspan="2">
                <textarea style="width: 100%; height: 60px;" id="descption" disabled="disabled"></textarea>
            </td>
            <td valign="top">
            </td>
        </tr>
        <tr>
            <td></td>
            <td colspan="3">
                <span></span>
                <span id="fileName1"></span>
            </td>
        </tr>
        </tbody>
    </table>
    <div class="line"></div>
    <div style="width: 98%; margin: 0 auto; padding:5px 0px;"><span
            style="font-size:16px; font-weight: bold;">关联服务单</span>&nbsp;&nbsp;&nbsp;<span>共${fn:length(cbsServiceEntityList)}条</span>
        <a style="float: right; margin-top:4px;" class="color-blue" onclick="serviceZk('${cbsCode}')">展开》</a>
    </div>
    <table class="ftable">
        <tr>
            <th>服务单号</th>
            <th>服务类型</th>
            <th>故障分类</th>
            <th>服务状态</th>
            <th>服务商</th>
            <th>服务商处理进度</th>
            <th>创建时间</th>
        </tr>
        <c:forEach items="${cbsServiceEntityList}" var="cbs" varStatus="a">
            <tr>
                <td><a href="#" onclick="cbsServiceDetials('${cbs.id}','${cbs.code}')">${cbs.code}</a></td>
                <td>
                    <c:if test="${not empty cbs.serviceType1}">
                        ${cbs.serviceType1.name}》${cbs.serviceType2.name}
                    </c:if>
                </td>
                <td>
                    <c:if test="${not empty cbs.errorType1}">
                        ${cbs.errorType1.name}》${cbs.errorType2.name}
                    </c:if>
                </td>
                <td>
                    <t:dictSelect clazz="noSelect" hasPleaseSelect="false" readonly="false" field="status"
                                  id="status_${a.index}" type="select" defaultVal="${cbs.status}"
                                  typeGroupCode="<%=StaticValue.Source_State %>"/>
                </td>
                <td></td>
                <td>
                    <t:dictSelect clazz="noSelect" hasPleaseSelect="false" readonly="false" field="speedStatus"
                                  id="speedStatus_${a.index}" type="select" defaultVal="${cbs.speedStatus}"
                                  typeGroupCode="<%=StaticValue.Third_Party_Processing_Progress %>"/>
                </td>
                <td><fmt:formatDate value='${cbs.createDate}' type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
            </tr>
        </c:forEach>
    </table>
</div>
<div class="subtitle">
    <p>第三方</p>
    <div style="height: 40px;line-height: 40px;padding-left:20px;">
        <div class="statesUpdate">
            <div class="states" style="background-color: #FF6600; color:#fff">HD待分派</div>
            <div class="triangle"></div>
        </div>
        <div class="statesUpdate">
            <div class="triangle_c_2" style="margin-left:10px;"></div>
            <div class="states" style="background-color: #E4E4E4; color : #999999;">已分派第三方</div>
            <div class="triangle_2"></div>
        </div>
        <div class="statesUpdate">
            <div class="triangle_c_2" style="margin-left:10px;"></div>
            <div class="states" style="background-color: #E4E4E4; color : #999999;">第三方已分配</div>
            <div class="triangle_2"></div>
        </div>
        <div class="statesUpdate">
            <div class="triangle_c_2" style="margin-left:10px;"></div>
            <div class="states" style="background-color: #E4E4E4; color : #999999;">区域工程师已分配</div>
            <div class="triangle_2"></div>
        </div>
        <div class="statesUpdate">
            <div class="triangle_c_2" style="margin-left:10px;"></div>
            <div class="states" style="background-color: #E4E4E4; color : #999999;">工程师已接受</div>
            <div class="triangle_2"></div>
        </div>
        <div class="statesUpdate">
            <div class="triangle_c_2" style="margin-left:10px;"></div>
            <div class="states" style="background-color: #E4E4E4; color : #999999;">工程师实施中</div>
            <div class="triangle_2"></div>
        </div>
        <div class="statesUpdate">
            <div class="triangle_c_2" style="margin-left:10px;"></div>
            <div class="states" style="background-color: #E4E4E4; color : #999999;">服务已完成</div>
        </div>
    </div>
    <table class="nobordertable noborder">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>服务商名称:</label>
            </td>
            <td width="30%">
                <span>
                    <select name="company" id="company" disabled="disabled" class="noSelect">
                        <option value="">---请选择--- </option>
                        <c:forEach items="${tsDeparts }" var="depart">
                            <option value="${depart.orgCode }">${depart.shortname }</option>
                        </c:forEach>
                    </select>
                </span>
            </td>
            <td class="al_r" width="20%">
                <label>负责人邮箱:</label>
            </td>
            <td width="30%">
                <span id="contacterEmail"></span>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>责任人:</label>
            </td>
            <td width="30%">
                <input name="contacterId" type="hidden" id="contacterId"/>
                <span id="contacterName"></span>
                &nbsp;
                <span id="contacterCellPhone"></span>
            </td>
            <td class="al_r" width="20%">
                <label>工程师级别:</label>
            </td>
            <td width="30%">
                <t:dictSelect readonly="readonly" type="select" clazz="noSelect" field="authentication"
                              id="authentication" typeGroupCode="<%=StaticValue.DIC_CERTIFICATE %>"
                              defaultVal="${mapList.authentication}"/>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%" valign="top">
                <label>服务商处理时间:</label>
            </td>
            <td width="30%">
                <span id="dealWithTime"></span>
            </td>
            <td class="al_r" width="20%" valign="top">
                <label>派单要求:</label>
            </td>
            <td width="30%">
                <span id="assignDes"></span>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%" valign="top">
                <label>巴可HD处理过程:</label>
            </td>
            <td width="30%">
                ${mapList.handledes}
            </td>
        </tr>
        </tbody>
    </table>
    <div style="width: 98%; margin: 0 auto; padding:5px 0px;"><span
            style="font-size:16px; font-weight: bold;">附加任务</span>
    </div>
    <table class="ftable">
        <tr>
            <th>对象</th>
            <th>待办内容</th>
            <th>已分派次数</th>
            <th>已完成次数</th>
            <th>未完成次数</th>
        </tr>
        <c:forEach items="${attachTaskByCondition}" var="attach">
            <tr>
                <td>${attach.attachTaskId.objectName}</td>
                <td>${attach.attachTaskId.content}</td>
                <td>${attach.attachTaskId.assignmentTotal}</td>
                <td>${attach.attachTaskId.completeTotal}</td>
                <td>${attach.attachTaskId.notCompleteTotal}</td>
            </tr>
        </c:forEach>
    </table>
</div>
<div class="subtitle">
    <p>备件申请</p>
    <c:forEach items="${cbsEquipmentApplyEntities}" var="a" varStatus="m">
        <div style="width: 98%; margin: 0 auto; padding:5px 0px;">
            <span style="font-size:16px; font-weight: bold;">备件申请${m.index+1}</span>
        </div>
        <table class="ftable">
            <tr>
                <th>备件申请单号</th>
                <th>备件类型</th>
                <th>备件号</th>
                <th>备件数量</th>
                <th>申请理由</th>
                <th>审批状态</th>
            </tr>
            <tr>
                <td><span class="color-blue" style="text-decoration: underline"
                          onclick="goSpareApplyDetail('${a.id}','${a.code}')">${a.code}</span></td>
                <td>${a.typedes}</td>
                <td>${a.item}</td>
                <td>${a.total}</td>
                <td>${a.reason}</td>
                <td>${a.status}</td>
            </tr>
            <tr>
                <td colspan="7">
                    <table class="ftable1">
                        <tr>
                            <th>发货状态</th>
                            <th>预计到货时间</th>
                            <th>实际到货时间</th>
                            <th>发货单号</th>
                            <th>备件类型</th>
                            <th>备件号</th>
                            <th>物流</th>
                            <th>物流发货时间</th>
                        </tr>
                        <c:forEach items="${a.cbsDeliverEquipmentEntities}" var="b">
                            <tr>
                                <td>${b.status}</td>
                                <td>${b.expecttime}</td>
                                <td>${b.gettime}</td>
                                <td>${b.code}</td>
                                <td>${b.typedes}</td>
                                <td>${b.item}</td>
                                <td>${b.deliverlogistics}</td>
                                <td>${b.logisticssendtime}</td>
                            </tr>
                        </c:forEach>
                    </table>
                </td>
            </tr>
        </table>
    </c:forEach>
    <div style="width: 98%; margin: 0 auto; padding:5px 0px;">
        <span style="font-size:16px; font-weight: bold;">到货异常记录</span>
    </div>
    <table class="ftable">
        <tr>
            <th>记录</th>
            <th>外箱是否完好</th>
            <th>引擎防震标签是否变红</th>
            <th>异常照片</th>
            <th>异常描述</th>
        </tr>
        <c:forEach items="${arrivalOfAbnormal}" var="a" varStatus="x">
            <tr>
                <td>${x.index+1}</td>
                <td>
                    <t:dictSelect field="status" clazz="noSelect" readonly="readonly"
                                  typeGroupCode="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM %>"
                                  defaultVal="${a.isIntact}"/>
                </td>
                <td>
                    <t:dictSelect field="status" clazz="noSelect" readonly="readonly"
                                  typeGroupCode="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM %>"
                                  defaultVal="${a.isNormal}"/>
                </td>
                <td><c:forEach items="${a.zyFileLogEntityList}" var="c">
                    <span class="color-blue"><a class="color-blue" href="fileUploadController.do?downLoadFile&fileLogId=${c.id}">${c.old_file_name}</a></span>
                </c:forEach></td>
                <td>${a.isContent}</td>
            </tr>
        </c:forEach>
    </table>
</div>
<div class="subtitle">
    <p>服务日志</p>
    <table class="ftable">
        <tr>
            <th>操作人</th>
            <th>时间</th>
            <th>描述</th>
        </tr>
        <c:forEach items="${cbsServiceLogList}" var="log">
            <tr>
                <td>${log.createName}</td>
                <td>${log.createDate}</td>
                <td>${log.description}</td>
            </tr>
        </c:forEach>
    </table>
</div>
<div class="subtitle">
    <p>附件列表</p>
    <table class="ftable">
        <tr>
            <th>文件名</th>
            <th>上传时间</th>
            <th>上传人</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${zyFileLogList}" var="file">
            <tr>
                <td>${file.NAME}</td>
                <td>${file.date}</td>
                <td>${file.createName}</td>
                <td>
                    <c:if test="${fn:contains(file.NAME,'.png')||fn:contains(file.NAME,'.jsp')}">
                        <span class="color-blue">
                            <a onclick="addOneTab('预览','cbsServiceController.do?openViewFile&fileid=${file.id}')">[查看]</a>
                        </span>&nbsp;&nbsp;
                    </c:if>
                    <span class="color-blue"><a
                            href="fileUploadController.do?downLoadFile&fileLogId=${file.id}">[下载]</a></span>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>
<input type="hidden" id="fileId"/>
<input type="hidden" id="fileName"/>
</body>
<script src="webpage/com/zybk/cbsservice/cbsService-add.js"></script>
<script>

    var speed = '${mapList.speed}';
    // console.info(speed);
    if (speed != "HD待分配") {
        $(".statesUpdate").children('div').each(function () {
            var $thisThing = $(this)[0].innerHTML;
            console.info($thisThing);
            if ($thisThing == speed) {
                this.style.backgroundColor = "#FF6600";
                this.style.color = "#fff";

                var m1 = $(this).prev();
                m1.css("border-top", "15px solid #FF6600");
                m1.css("border-bottom", "15px solid #FF6600");
                var m2 = $(this).next();
                m2.css("border-left", "8px solid #FF6600");
                m2.css("border-top", "15px solid #fff");
                m2.css("border-bottom", "15px solid #fff");

            } else {
                $(".triangle").css("background-color", "");
                $(".triangle").css("border-left", "15px solid rgb(228, 228, 228)");
                this.style.backgroundColor = "#E4E4E4";
                this.style.color = "#999999";
                this.style.border_left = "8px solid rgb(255, 102, 0)";
                this.style.border_bott = "15px solid transparent";
            }
        });
    }

    $(function () {

        //第三方服务单code
        var serviceProviderCode = '${mapList.serviceProviderCode}';
        var repairProvider = '${mapList.repairProvider}';
        var cbsId = '${mapList.cid}';
        var orgCode = '';

        //查找服务商处理时间
        $.ajax({
            url: "cbsServiceController.do?getServiceProvidersDealTime",
            data: {
                "cbsServiceId": cbsId
            },
            cache: false,
            dataType: 'json',
            type: 'POST',
            success: function (data) {
                var value = data.obj;
                $("#dealWithTime").text(value);
            }
        });

        if (repairProvider != null && repairProvider != '') {   //合同指定的，第一次回显
            $("select[name='company']").val(repairProvider);
            orgCode = repairProvider;
        }
        if (serviceProviderCode != null && serviceProviderCode != '') {   //服务单指派后的服务商，默认回显
            $("select[name='company']").val(serviceProviderCode);
            orgCode = serviceProviderCode;
        }
        if (orgCode != null && orgCode != '') {
            $.ajax({
                url: "cbsServiceController.do?queryTPServerBusinessr",
                data: {
                    "orgCode": orgCode,
                    "cbsId": cbsId,
                    "contactPosition": '<%=StaticValue.DIC_CONTACT_POSITION_TP_SERVER_BUSINESSR%>'
                },
                cache: false,
                dataType: 'json',
                type: 'POST',
                success: function (data) {
                    if (data.success) {
                        var objects = data['attributes'].objects[0];
                        var obj = data['attributes'].zyContacts[0];
                        if (obj) {
                            if (typeof(objects) != "undefined" && objects != '') {
                                setContacters(obj.id, obj.name, obj.cellphone1 + (obj.cellphone2 == "" ? "" : ("/"+obj.cellphone2)), (obj.email == "" ? "" : (obj.email)), (objects.assignDes == "" ? "" : (objects.assignDes)), (objects.dealWithTiem == "" ? "" : (objects.dealWithTiem)));
                            } else {
                                setContacters(obj.id, obj.name, obj.cellphone1 + (obj.cellphone2 == "" ? "" : ("/"+obj.cellphone2)), (obj.email == "" ? "" : (obj.email)), '', '', '');
                            }

                        } else {
                            setContacters();
                        }
                    }
                }
            });
        }
    });

    function setContacters(id, name, cellPhone, email, assignDes, dealWithTiem) {
        if (id == undefined || id == "") {
            $("#contacterId").val("");  //巡检负责人id
            $("#contacterName").html("");  //巡检负责人name
            $("#contacterCellPhone").html("");  //巡检负责人电话
            $("#contacterEmail").html(""); //巡检负责人email
            $("#assignDes").html(""); //巡检负责人email
            $("#dealWithTiem").html(""); //巡检负责人email
        } else {
            $("#contacterId").val(id);
            $("#contacterName").html(name);
            $("#contacterCellPhone").html(cellPhone);
            $("#contacterEmail").html(email);
            $("#assignDes").html(assignDes);
            $("#dealWithTiem").html(dealWithTiem);
        }
    }


    function getyyyyMMdd() {
        var d = new Date();
        var curr_date = d.getDate();
        var curr_month = d.getMonth() + 1;
        var curr_year = d.getFullYear();
        var curr_hours = d.getHours();
        var curr_minutes = d.getMinutes();
        var curr_sends = d.getSeconds();
        var curr_millSends = d.getMilliseconds();
        String(curr_month).length < 2 ? (curr_month = "" + curr_month) : curr_month;
        String(curr_date).length < 2 ? (curr_date = "" + curr_date) : curr_date;
        String(curr_hours).length < 2 ? (curr_month = "0" + curr_hours) : curr_hours;
        String(curr_minutes).length < 2 ? (curr_minutes = "0" + curr_minutes) : curr_minutes;
        String(curr_sends).length < 2 ? (curr_sends = "0" + curr_sends) : curr_sends;
        String(curr_millSends).length < 2 ? (curr_millSends = "0" + curr_millSends) : curr_millSends;
        var yyyyMMdd = curr_year + "-" + curr_month + "-" + curr_date + " " + curr_hours + ":" + curr_minutes + ":" + curr_sends + "";
        return yyyyMMdd;
    }

    function tanchu() {
        var cbserviceId = ${mapList.cid};
        $.dialog({
            content: "url:cbsServiceController.do?goPD",
            zIndex: 2100,
            title: '内部派单',
            lock: true,
            width: '800px',
            height: '500px',
            left: '85%',
            top: '65%',
            opacity: 0.4,
//                init: function () {
//                    top.myWindow = window;
//                },
            button: [{
                name: '确认',
                callback: function () {
                    var personId = $.session.get("personId");
                    var personName = $.session.get("name");
                    var desption = $.session.get("desption");
                    if (typeof(desption) == "undefined") {
                        // tip("请您填写描述信息");
                        return false;
                    }
                    //缺少当前责任人名字  id
                    $("#person_lain").html(personName);
                    $("#personId").html(personId);
                    $.ajax({
                        type: "GET",
                        url: "cbsServiceController.do?changePerson",
                        //应传入服务单id和责任人id
                        data: {"id": personId, "cbserviceId": cbserviceId, "desption": desption},
                        dataType: "json",
                        success: function (data) {
                            tip("转派成功");
                            $.ajax({
                                type: "post",
                                data: {"id": cbserviceId},
                                url: "cbsServiceController.do?toSendLog",
                                dataType: "json",
                                success: function (data) {
                                    Date.prototype.toLocaleString = function () {
                                        return this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + this.getDate() + " " + this.getHours() + ":" + this.getMinutes() + ":" + this.getSeconds();
                                    };
                                    var obj = data.obj;
                                    var html = "";
                                    for (i in obj) {
                                        html += "<tr class='cbsHandleLog'><td>" + obj[i].createName + "</td><td>" + new Date(obj[i].createDate).toLocaleString() + "</td><td>" + obj[i].description + "</td><td>" + obj[i].fileName + "</td></tr>";
                                    }
                                    $(".cbsHandleLog").remove();
                                    $("#cbsLog").after(html);

                                }
                            })
                        }
                    })
                },
                focus: true
            }, {
                name: '返回',
                callback: function () {
                }
            }]
        });
    }


    $('#ct span').click(function () {
        var i = $(this).index();
        $(this).addClass('select').siblings().removeClass('select');
        $('#cl li').eq(i).show().siblings().hide();
    });
    $('#ct1 span').click(function () {
        var i = $(this).index();
        $(this).addClass('select').siblings().removeClass('select');
        $('#cl1 li').eq(i).show().siblings().hide();
    });

    $(document).ready(function () {
        $('#ct span').click(function () {
            var i = $(this).index();
            $(this).addClass('select').siblings().removeClass('select');
            $('#cl li').eq(i).show().siblings().hide();
        });
        $('#ct1 span').click(function () {
            var i = $(this).index();
            $(this).addClass('select').siblings().removeClass('select');
            $('#cl1 li').eq(i).show().siblings().hide();
        });

        $("[id^=sourceType_]").attr("disabled", "disabled");
        $("[id^=status_]").attr("disabled", "disabled");
        $("[id^=speedStatus_]").attr("disabled", "disabled");


    });

    function viewDetail(id) {
        if (null != id && id != '') {
            addOneTab('设备详细', 'zyEquipmentSpareController.do?goView&id=' + id);
        } else {
            tip("设备不存在！");
        }
    }

    function view(id) {
        if (null != id && id != '') {
            addOneTab('设备详细', 'zyEquipmentSpareController.do?goView&id=' + id);
        } else {
            tip("设备不存在！");
        }
    }

    $(function () {
        var city = "${requestScope.mapList.city}";
        loadCity(city);

        var serviceType2 = "${requestScope.mapList.service_type_2}";
        loadService(serviceType2);

        var errorType2 = '${requestScope.mapList.error_type_2}';
        loadErrorType2(errorType2);

        var equipmentErrorType2 = '${requestScope.mapList.equipment_error_type_2}';
        loadEquipmentErrorType2(equipmentErrorType2);


        var errorCode = '${requestScope.mapList.errorCode}';
        /*回显*/
        $.each(errorCode.split(","), function (idx, itm) {
            if ('' != itm && itm != null) {
                var i = idx + 1;
                $("#errorCodeSpan").after(itm);
            }
        });

    });

    //二级联动
    function loadService(serviceId) {
        var id = $('#serviceType1').val();
        $.post('cbsServiceController.do?getServiceType2', {id: id}, function (data) {
            data = $.parseJSON(data);
            $('#serviceType2').find('option').remove();
            var str = "";
            for (var i = 0; i < data.length; i++) {
                str += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
            }
            $('#serviceType2').append(str);
            if (serviceId != '') {
                $('#serviceType2').val(serviceId);
            }
        });
    }

    //二级联动
    function loadErrorType2(errorType1) {
        var id = $('#errorType1').val();
        $.post('cbsServiceController.do?getErrorType2', {id: id}, function (data) {
            data = $.parseJSON(data);
            $('#errorType2').find('option').remove();
            var str = "";
            for (var i = 0; i < data.length; i++) {
                str += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
            }
            $('#errorType2').append(str);
            if (errorType1 != '') {
                $('#errorType2').val(errorType1);
            }
        });
    }

    //二级联动
    function loadEquipmentErrorType2(equipmentErrorType2) {
        var id = $('#equipmentErrorType1').val();
        $.post('cbsServiceController.do?getEquipmentErrorType2', {id: id}, function (data) {
            data = $.parseJSON(data);
            $('#equipmentErrorType2').find('option').remove();
            var str = "";
            for (var i = 0; i < data.length; i++) {
                str += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
            }
            $('#equipmentErrorType2').append(str);
            if (equipmentErrorType2 != '') {
                $('#equipmentErrorType2').val(equipmentErrorType2);
            }
        });
    }

    function spread() {
        var type = 1;
        var sn = $("#sn").val();
        if ("" == sn) {
            sn = $("#snServer").val();
            if ("" == sn) {
                alert("请填写设备序列号");
            }
        }
        var select = $("span.select").text();
        if (select.indexOf("设备") >= 0) {
            type = 1;
        }
        if (select.indexOf("影院") >= 0) {
            type = 2;
        }
        if (select.indexOf("巡检") >= 0) {
            type = 3;
        }
        openwindow('展开', 'cbsServiceController.do?getDetial&sn=' + sn + '&type=' + type, '', 800, 300);
    }


    // function lookReport(id) {
    //     addOneTab("查看完工报告", "cbsServiceReportController.do?lookReport&id=" + id, "");
    // }

    function downloadFile(fileId) {
        myDownload("fileUploadController.do?downLoadFile&fileLogId=" + fileId + "");
    }

    /*
    * 备件申请详情
    * */
    function goSpareApplyDetail(applyId, code) {
        addOneTab("备件申请详情" + code, "cbsEquipmentApplyController.do?goSpareApplyDetail&applyId=" + applyId + "");
    }


    /*关联父子单展开*/
    function serviceZk(code) {
        openwindow('展开', 'cbsServiceController.do?getDetial&sn=' + code + '&type=' + 4, '', 800, 300);
    }

    /*处理描述展开*/
    function serviceCl(id) {
        openwindow('展开', 'cbsServiceController.do?getDetial&sn=' + id + '&type=' + 5, '', 800, 300);
    }

</script>

</html>